package entity;

import java.util.Scanner;

import exception.SubmissionException;

public class Darwin {

	private static Assignment assignment;
	public static void main(String args[]) throws SubmissionException {
		
		try {
			String ID, pass, subjectCode, filename;
			int choice;
			
			Scanner input = new Scanner(System.in);
			System.out.println("Please Log In");
			
			System.out.println("User Name: ");
			ID = input.next();
			
			System.out.println("Password: ");
			pass = input.next();

			System.out.println("Subject code: ");
			subjectCode = input.next();
			
			
			System.out.println("Menu:- \n Choose your choice: \n 1. Submit Assignment \n 2. View Submission Status \n 3. Exit Program");
			choice = input.nextInt();
			
			int count = 0;
			do {
					if (count != 0) {
					System.out
							.println("Menu:- \n Choose your choice: \n 1. Submit Assignment \n 2. View Submission Status \n 3. Exit Program");
					choice = input.nextInt();
				}
					
				if (choice == 1) {

					System.out.println("Enter the file to submit");
					filename = input.next();

					 assignment = new Assignment(ID, subjectCode);
					 
					 System.out.println(assignment.Submit(filename));
					 
					 
				} else if (choice == 2) {

					assignment = new Assignment(ID, subjectCode);
					System.out.println(assignment.CheckStatus());					
				
				}
				count++;
			} while (choice < 3);
			
			System.out.println("Bye!");
			//System.exit(-1);
			
		} catch (RuntimeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			System.out.println("You must have input the wrong format of data.");
		}
		
	}
}
